SELECT 
  cscart_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      cscart_products_categories.link_type = "M", 
      CONCAT(
        cscart_products_categories.category_id, 
        "M"
      ), 
      cscart_products_categories.category_id
    )
  ) AS category_ids 
FROM 
  cscart_products_categories 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
WHERE 
  cscart_products_categories.product_id IN (
    403166, 443366, 406831, 433693, 445954, 
    441514, 409350, 459209, 410927, 406634, 
    450452, 453579, 428056, 419040, 408601, 
    433947, 418245, 450170, 460049, 430800, 
    435777, 452645, 446157, 434819, 439332, 
    410664, 457167, 442668, 438623, 443841, 
    442218, 414148, 426118, 460489, 445497, 
    420289, 445023, 406489, 425857, 423797, 
    409307, 457277, 414945, 450623, 417564, 
    405376, 423809, 415249
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00076

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.161436522,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "range",
          "possible_keys": ["PRIMARY", "pt"],
          "key": "pt",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "loops": 1,
          "rows": 48,
          "cost": 0.08683616,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (403166,443366,406831,433693,445954,441514,409350,459209,410927,406634,450452,453579,428056,419040,408601,433947,418245,450170,460049,430800,435777,452645,446157,434819,439332,410664,457167,442668,438623,443841,442218,414148,426118,460489,445497,420289,445023,406489,425857,423797,409307,457277,414945,450623,417564,405376,423809,415249)",
          "using_index": true
        }
      },
      {
        "table": {
          "table_name": "cscart_categories",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": ["u985510652_ecartify.cscart_products_categories.category_id"],
          "loops": 48,
          "rows": 1,
          "cost": 0.04375232,
          "filtered": 100,
          "attached_condition": "cscart_categories.storefront_id in (0,1) and (cscart_categories.usergroup_ids = '' or find_in_set(0,cscart_categories.usergroup_ids) or find_in_set(1,cscart_categories.usergroup_ids)) and cscart_categories.`status` in ('A','H')"
        }
      }
    ]
  }
}

Result

product_id category_ids
403166 500M
405376 498M
406489 289M
406634 500M
406831 498M
408601 498M
409307 289M
409350 500M
410664 498M
410927 495M
414148 495M
414945 289M
415249 500M
417564 289M
418245 500M
419040 289M
420289 305M
423797 498M
423809 500M
425857 305M
426118 289M
428056 305M
430800 289M
433693 289M
433947 498M
434819 498M
435777 500M
438623 305M
439332 495M
441514 289M
442218 500M
442668 305M
443366 289M
443841 498M
445023 495M
445497 498M
445954 289M
446157 500M
450170 498M
450452 305M
450623 498M
452645 305M
453579 498M
457167 500M
457277 305M
459209 305M
460049 500M
460489 500M