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 (
    12664, 12667, 12666, 12751, 2641, 2642, 
    2635, 2636, 12691, 12690, 12692, 2199, 
    2200, 2237, 12678, 3238, 3237, 12656, 
    13107, 12672, 12671, 11136, 2772, 11808
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00084

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": 25,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (12664,12667,12666,12751,2641,2642,2635,2636,12691,12690,12692,2199,2200,2237,12678,3238,3237,12656,13107,12672,12671,11136,2772,11808)"
    },
    "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
2199 357M
2200 357M
2237 357M
2635 356M
2636 356M
2641 356M
2642 356M
2772 356M
3237 392M
3238 392M
11136 356M
11808 356M
12656 392M
12664 392M
12666 392M
12667 392M
12671 392M
12672 392M
12678 392M
12690 356M
12691 356M
12692 356M
12751 357M
13107 392,265M