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 (
    101808, 101807, 101806, 101805, 101804, 
    101803, 101802, 101801, 101800, 101799, 
    101798, 101797, 101796, 101795, 101794, 
    101793, 101792, 101791, 101790, 101789, 
    101788, 101787, 101786, 101785, 101784, 
    101783, 101782, 101781, 101780, 101779
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00043

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 30 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
101779 4M
101780 4M
101781 4M
101782 4M
101783 4M
101784 4M
101785 4M
101786 4M
101787 4M
101788 4M
101789 4M
101790 4M
101791 4M
101792 4M
101793 4M
101794 4M
101795 4M
101796 4M
101797 4M
101798 4M
101799 4M
101800 4M
101801 4M
101802 4M
101803 4M
101804 4M
101805 4M
101806 4M
101807 4M
101808 4M