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 (
    104632, 104631, 104630, 104629, 104628, 
    104627, 104626, 104625, 104624, 104623, 
    104622, 104621, 104620, 104619, 104618, 
    104617, 104616, 104615, 104614, 104613, 
    104612, 104611, 104610, 104609, 104608, 
    104607, 104606, 104605, 104604, 104603
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00059

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
104603 4M
104604 4M
104605 4M
104606 4M
104607 4M
104608 4M
104609 4M
104610 4M
104611 4M
104612 4M
104613 4M
104614 4M
104615 4M
104616 4M
104617 4M
104618 4M
104619 4M
104620 4M
104621 4M
104622 4M
104623 4M
104624 4M
104625 4M
104626 4M
104627 4M
104628 4M
104629 4M
104630 4M
104631 4M
104632 4M