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 (
    47948, 47947, 47946, 47945, 47944, 47943, 
    47942, 47941, 47940, 47939, 47938, 
    47937, 47936, 47935, 47934, 47933, 
    47932, 47806, 47805, 47804
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00040

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 21 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
47804 22M
47805 22M
47806 23,13M
47932 4M
47933 4M
47934 4M
47935 4M
47936 4M
47937 4M
47938 4M
47939 4M
47940 4M
47941 4M
47942 4M
47943 4M
47944 4M
47945 4M
47946 4M
47947 4M
47948 4M