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 (
    120592, 120591, 120590, 120589, 120588, 
    120587, 120586, 120585, 120584, 120583, 
    120582, 120581, 120580, 120579, 120578, 
    120577, 120576, 120575, 120574, 120573, 
    120572, 120571
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00034

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 23 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
120571 1M
120572 1M
120573 1M
120574 29,4M
120575 1M
120576 1M
120577 1M
120578 1M
120579 1M
120580 1M
120581 1M
120582 1M
120583 1M
120584 3M
120585 1M
120586 1M
120587 1M
120588 1M
120589 1M
120590 1M
120591 4M
120592 3M