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 (
    118790, 118789, 118788, 118787, 118786, 
    118785, 118784, 118783, 118782, 118781, 
    118780, 118779, 118778, 118777, 118776, 
    118775, 118774, 118773, 118772, 118771, 
    118770, 118769, 118768
  ) 
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 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
118768 6M
118769 6M
118770 6M
118771 6M
118772 6M
118773 6M
118774 6M
118775 6M
118776 6M
118777 6M
118778 6M
118779 6M
118780 6M
118781 6M
118782 6M
118783 6M
118784 6M
118785 6M
118786 6M
118787 6M
118788 6M
118789 6M
118790 6M