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 (
    119395, 119394, 119393, 119392, 119391, 
    119390, 119389, 119388, 119387, 119386, 
    119385, 119384, 119383, 119382, 119381, 
    119380, 119379, 119378, 119377, 119376, 
    119375, 119374, 119373
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00036

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
119373 4M
119374 4M
119375 4M
119376 4M
119377 4M
119378 4M
119379 4M
119380 4M
119381 4M
119382 4M
119383 4M
119384 4M
119385 4M
119386 4M
119387 4M
119388 4M
119389 4M
119390 4M
119391 3M
119392 4M
119393 4M
119394 4M
119395 4M