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 (
    121273, 121272, 121271, 121270, 121269, 
    121268, 121267, 121266, 121265, 121264, 
    121263, 121262, 121261, 121260, 121259, 
    121258, 121257, 121256, 121255, 121254, 
    121253, 121252, 121251
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00053

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 43 Using where; Using index
1 SIMPLE cscart_categories eq_ref PRIMARY,c_status,p_category_id PRIMARY 3 toolboxdigitalshop_dev.cscart_products_categories.category_id 1 Using where

Result

product_id category_ids
121251 29,4M
121252 3M
121253 29,4M
121254 29,4M
121255 29,4M
121256 29,4M
121257 29,4M
121258 29,4M
121259 29,4M
121260 29,4M
121261 29,4M
121262 29,4M
121263 29,4M
121264 29,4M
121265 29,4M
121266 29,4M
121267 4M
121268 29,4M
121269 29,4M
121270 29,4M
121271 29,4M
121272 29,4M
121273 3M