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 (
    103863, 103862, 103861, 103860, 103859, 
    103858, 103857, 103856, 103855, 103854, 
    103853, 103852, 103851, 103850, 103849, 
    103848, 103847, 103846, 103845, 103844, 
    103843, 103842, 103841, 103840, 103839, 
    103838, 103837, 103836, 103835
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00056

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
103835 1M
103836 4M
103837 3M
103838 4M
103839 4M
103840 4M
103841 4M
103842 4M
103843 4M
103844 4M
103845 4M
103846 4M
103847 4M
103848 3M
103849 4M
103850 4M
103851 4M
103852 4M
103853 3M
103854 4M
103855 3M
103856 3M
103857 3M
103858 4M
103859 4M
103860 4M
103861 4M
103862 4M
103863 3M