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 (
    14081, 14115, 14114, 18564, 18485, 18486, 
    18487, 14113, 18572, 14046, 14104, 
    14074, 14073, 14072, 14099, 18550, 
    18566, 14098, 14071, 18481, 19930, 
    19942, 19936, 19937
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00041

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.067580595,
    "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": 25,
          "cost": 0.025937925,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (14081,14115,14114,18564,18485,18486,18487,14113,18572,14046,14104,14074,14073,14072,14099,18550,18566,14098,14071,18481,19930,19942,19936,19937)",
          "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": ["u508912950_dev_2025.cscart_products_categories.category_id"],
          "loops": 25,
          "rows": 1,
          "cost": 0.0256378,
          "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
14046 644M
14071 644M
14072 644M
14073 644M
14074 644M
14081 644M
14098 644M
14099 644M
14104 644M
14113 644M
14114 644M
14115 644M
18481 471M
18485 309M
18486 309M
18487 309M
18550 1690M
18564 1690M
18566 1716M
18572 1716M
19930 1726,1614M
19936 484M
19937 484M
19942 485M