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 (
    10529, 10528, 10527, 10526, 10525, 10524, 
    10522, 10495, 10494, 10493, 10492, 
    10491, 10490, 10489, 10488, 10487, 
    10486, 10485, 10483, 10482, 10481, 
    10480, 10479, 10478, 10477, 10476, 
    10475, 10474, 10473, 10472, 10471, 
    10470, 10469, 10468, 10467, 10466, 
    12582, 12583, 12584, 10465, 10464, 
    10463, 10462, 10461, 10460, 10459, 
    12581, 12699, 12698, 12697, 12696, 
    12695, 12694, 12693, 12692, 12691, 
    10447, 10448, 10449, 10450, 10451, 
    10452, 10453, 10454
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00081

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": 68,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (10529,10528,10527,10526,10525,10524,10522,10495,10494,10493,10492,10491,10490,10489,10488,10487,10486,10485,10483,10482,10481,10480,10479,10478,10477,10476,10475,10474,10473,10472,10471,10470,10469,10468,10467,10466,12582,12583,12584,10465,10464,10463,10462,10461,10460,10459,12581,12699,12698,12697,12696,12695,12694,12693,12692,12691,10447,10448,10449,10450,10451,10452,10453,10454)"
    },
    "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
10447 1656M
10448 1656M
10449 1656M
10450 1656M
10451 1656M
10452 1656M
10453 1656M
10454 1656M
10459 1658M
10460 1658M
10461 1658M
10462 1658M
10463 1658M
10464 1658M
10465 1658M
10466 327M
10467 327M
10468 327M
10469 327M
10470 327M
10471 327M
10472 327M
10473 327M
10474 327M
10475 327M
10476 327M
10477 327M
10478 327M
10479 327M
10480 327M
10481 327M
10482 327M
10483 327M
10485 327M
10486 327M
10487 327M
10488 327M
10489 327M
10490 327M
10491 327M
10492 327M
10493 327M
10494 327M
10495 327M
10522 1651M
10524 1657M
10525 1657M
10526 1657M
10527 1657M
10528 1657M
10529 1657M
12581 277,267,278M
12582 267,277,278M
12583 267,277,278M
12584 278,267,277M
12691 1656M
12692 1656M
12693 1656M
12694 1656M
12695 1656M
12696 1656M
12697 1656M
12698 1656M
12699 1656M