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 (
    59546, 59545, 59544, 59543, 59542, 59541, 
    59540, 59539, 59538, 59537, 59536, 
    59535, 59534, 59533, 59532, 59530, 
    59529, 59528, 59527, 59526
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00048

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 20 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
59526 4M
59527 4M
59528 4M
59529 4M
59530 4M
59532 4M
59533 4M
59534 4M
59535 4M
59536 4M
59537 4M
59538 4M
59539 4M
59540 4M
59541 4M
59542 4M
59543 4M
59544 4M
59545 4M
59546 4M