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 (
    43816, 43815, 43814, 43813, 43812, 43811, 
    43810, 43809, 43808, 43807, 43806, 
    43805, 43804, 43803, 43802, 43598, 
    43597, 43596, 43595, 43594
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00034

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
43594 1M
43595 4M
43596 1M
43597 4M
43598 17,13M
43802 3M
43803 4M
43804 4M
43805 1M
43806 1M
43807 1M
43808 1M
43809 4M
43810 1M
43811 4M
43812 4M
43813 1M
43814 1M
43815 1M
43816 3M