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 (
    42268, 42267, 42266, 42265, 42264, 42263, 
    42262, 42261, 42260, 42259, 42258, 
    42257, 42256, 42255, 42254, 42253, 
    42252, 42251, 42250, 42249
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00037

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 20 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
42249 4M
42250 4M
42251 4M
42252 4M
42253 4M
42254 4M
42255 4M
42256 4M
42257 4M
42258 4M
42259 4M
42260 4M
42261 4M
42262 4M
42263 4M
42264 4M
42265 4M
42266 4M
42267 4M
42268 4M