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 (
    10205, 10206, 10207, 10208, 10209, 10210, 
    10211, 10212, 10213, 10214, 10215, 
    10216, 10217, 10218, 10219, 10220, 
    10221, 10222, 10144, 10145, 10146, 
    10147, 10148, 10149, 10150, 10151, 
    10152, 12969, 10103, 10104, 10105, 
    10106
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00190

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": 32,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (10205,10206,10207,10208,10209,10210,10211,10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10144,10145,10146,10147,10148,10149,10150,10151,10152,12969,10103,10104,10105,10106)"
    },
    "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
10103 1618M
10104 1618M
10105 1618M
10106 1618M
10144 1151M
10145 1151M
10146 1151M
10147 1151M
10148 1151M
10149 1151M
10150 1151M
10151 1151M
10152 1151M
10205 1637M
10206 1637M
10207 1637M
10208 1637M
10209 1637M
10210 1637M
10211 1637M
10212 1637M
10213 1637M
10214 1637M
10215 1637M
10216 1637M
10217 1637M
10218 1637M
10219 1637M
10220 1637M
10221 1637M
10222 1637M
12969 301,1151M