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 (
    119709, 119708, 119707, 119706, 119705, 
    119704, 119703, 119702, 119701, 119700, 
    119699, 119698, 119697, 119696, 119695, 
    119694, 119693, 119692, 119691, 119690, 
    119689, 119688
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00048

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 29 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
119688 4M
119689 4M
119690 3M
119691 3M
119692 4M
119693 29,4M
119694 4M
119695 4M
119696 29,4M
119697 4M
119698 4M
119699 4M
119700 4M
119701 4M
119702 29,4M
119703 29,4M
119704 29,4M
119705 29,4M
119706 3M
119707 3M
119708 29,4M
119709 4M