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 (
    78060, 78059, 78058, 78057, 78056, 78055, 
    77717, 77716, 77715, 77714, 77713, 
    77712, 77711, 77710, 77709, 77708, 
    77707, 77706, 77705, 77704
  ) 
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
77704 4M
77705 4M
77706 4M
77707 4M
77708 4M
77709 4M
77710 4M
77711 4M
77712 4M
77713 4M
77714 4M
77715 4M
77716 4M
77717 18,13M
78055 1M
78056 1M
78057 1M
78058 1M
78059 1M
78060 1M