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 (
    63045, 63044, 63043, 63042, 63041, 63040, 
    63039, 63038, 63037, 63036, 63035, 
    63034, 63033, 63032, 63031, 63030, 
    63029, 63028, 63027, 63026, 63025, 
    63024, 63023, 63022, 63021
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00042

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
63021 22M
63022 22M
63023 22M
63024 22M
63025 22M
63026 22M
63027 22M
63028 22M
63029 22M
63030 22M
63031 22M
63032 22M
63033 22M
63034 22M
63035 22M
63036 22M
63037 22M
63038 22M
63039 22M
63040 22M
63041 22M
63042 22M
63043 22M
63044 22M
63045 22M