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 (
    62565, 62564, 62563, 62562, 62561, 62560, 
    62559, 62558, 62557, 62556, 62555, 
    62554, 62553, 62552, 62551, 62550, 
    62549, 62548, 62547, 62546, 62545, 
    62544, 62543, 62542, 62541
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00037

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 25 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
62541 1M
62542 1M
62543 1M
62544 1M
62545 1M
62546 1M
62547 1M
62548 1M
62549 1M
62550 1M
62551 1M
62552 1M
62553 1M
62554 1M
62555 1M
62556 1M
62557 1M
62558 1M
62559 1M
62560 1M
62561 1M
62562 1M
62563 1M
62564 1M
62565 1M