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 (
    10102, 10643, 10178, 10177, 10606, 10644, 
    10101, 10175, 10100, 15962, 15961, 
    15960, 15959, 10094, 10093, 9813, 10097, 
    9760, 9759, 9934, 9933, 9932, 9931, 
    9936, 9947, 9953, 9952, 10074, 10096, 
    10075, 10602, 10087, 10130, 10603, 
    10135, 10134, 10139, 10138, 10137, 
    10141, 10143, 10142, 12628, 12627, 
    12629, 10095, 10195, 10194, 10193, 
    10190, 10496, 10198, 10202, 10201, 
    10200, 10227, 10226, 10651, 9945, 10642, 
    10601, 9727, 9728, 9729
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00181

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": 79,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (10102,10643,10178,10177,10606,10644,10101,10175,10100,15962,15961,15960,15959,10094,10093,9813,10097,9760,9759,9934,9933,9932,9931,9936,9947,9953,9952,10074,10096,10075,10602,10087,10130,10603,10135,10134,10139,10138,10137,10141,10143,10142,12628,12627,12629,10095,10195,10194,10193,10190,10496,10198,10202,10201,10200,10227,10226,10651,9945,10642,10601,9727,9728,9729)"
    },
    "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": ["noframes_angrybeaver.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
9727 1671M
9728 1671M
9729 1671M
9759 275M
9760 275M
9813 1666M
9931 275M
9932 275M
9933 275M
9934 275M
9936 275M
9945 1671M
9947 275M
9952 275M
9953 275M
10074 275M
10075 275M
10087 275M
10093 1666M
10094 1666M
10095 1666M
10096 1666M
10097 1666M
10100 275M
10101 275M
10102 275M
10130 275M
10134 275M
10135 275M
10137 275M
10138 275M
10139 275M
10141 275M
10142 275M
10143 275M
10175 1666M
10177 1666M
10178 1666M
10190 275M
10193 275M
10194 275M
10195 275M
10198 275M
10200 275M
10201 275M
10202 275M
10226 275M
10227 275M
10496 275M
10601 1671M
10602 275M
10603 275M
10606 1666M
10642 275M
10643 1666M
10644 1666M
10651 275M
12627 277,270,267M
12628 267,277,270M
12629 267,277,270M
15959 272M
15960 272M
15961 272M
15962 272M