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 (
    436995, 458366, 453105, 401320, 424315, 
    420368, 433313, 439794, 416568, 419977, 
    439743, 414898, 420267, 406851, 447289, 
    403492, 451195, 416661, 411798, 455469, 
    403314, 455698, 415839, 451947
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00057

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.081460403,
    "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": 24,
          "cost": 0.04381364,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (436995,458366,453105,401320,424315,420368,433313,439794,416568,419977,439743,414898,420267,406851,447289,403492,451195,416661,411798,455469,403314,455698,415839,451947)",
          "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": 24,
          "rows": 1,
          "cost": 0.02228576,
          "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
401320 495M
403314 289M
403492 305M
406851 305M
411798 289M
414898 305M
415839 495M
416568 500M
416661 495M
419977 495M
420267 289M
420368 498M
424315 495M
433313 495M
436995 305M
439743 498M
439794 500M
447289 289M
451195 500M
451947 495M
453105 289M
455469 305M
455698 500M
458366 495M