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 (
    45227, 45226, 45225, 45224, 45223, 45222, 
    45221, 45220, 45219, 45218, 45217, 
    45216, 45215, 44881, 44880, 44879, 
    44878, 44877, 44876, 44875
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00039

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
44875 1M
44876 1M
44877 1M
44878 4M
44879 1M
44880 1M
44881 17,13M
45215 22M
45216 22M
45217 22M
45218 22M
45219 22M
45220 22M
45221 22M
45222 22M
45223 22M
45224 22M
45225 22M
45226 22M
45227 22M