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 (
    2788, 2612, 15385, 2608, 2609, 2561, 
    2610, 2611, 2571, 2317, 2318, 12754, 
    11610, 11606, 11818, 11607, 11608, 
    14076, 14077, 11135, 12977, 12677, 
    12654, 2763
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00046

JSON explain

{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "cscart_products_categories",
      "access_type": "range",
      "possible_keys": ["PRIMARY", "pt"],
      "key": "pt",
      "key_length": "3",
      "used_key_parts": ["product_id"],
      "rows": 28,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (2788,2612,15385,2608,2609,2561,2610,2611,2571,2317,2318,12754,11610,11606,11818,11607,11608,14076,14077,11135,12977,12677,12654,2763)"
    },
    "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": ["ymonline_livedata.cscart_products_categories.category_id"],
      "rows": 1,
      "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
2317 357M
2318 357M
2561 356M
2571 356M
2608 356M
2609 356M
2610 356M
2611 356M
2612 356M
2763 356M
2788 356M
11135 356M
11606 383M
11607 383M
11608 383M
11610 383M
11818 383M
12654 392M
12677 392M
12754 357M
12977 392,265M
14076 383,265M
14077 383,265M
15385 356,265M