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 (
    45646, 45645, 45644, 45643, 45642, 45641, 
    45640, 45240, 45239, 45238, 45237, 
    45236, 45235, 45234, 45233, 45232, 
    45231, 45230, 45229, 45228
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00041

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
45228 22M
45229 22M
45230 22M
45231 22M
45232 22M
45233 22M
45234 22M
45235 22M
45236 22M
45237 22M
45238 22M
45239 22M
45240 23,13M
45640 1M
45641 3M
45642 1M
45643 3M
45644 1M
45645 3M
45646 4M