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 (
    23425, 23426, 23427, 23416, 23417, 23418, 
    23419, 23420, 23421, 23422, 23423, 
    23424, 23415, 23414, 23476, 23477, 
    23928, 23478, 23929, 23479, 23480, 
    23481, 23482, 23455
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00069

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "range",
          "possible_keys": ["PRIMARY", "pt"],
          "key": "pt",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "rows": 48,
          "filtered": 100,
          "index_condition": "cscart_products_categories.product_id in (23425,23426,23427,23416,23417,23418,23419,23420,23421,23422,23423,23424,23415,23414,23476,23477,23928,23478,23929,23479,23480,23481,23482,23455)"
        }
      },
      {
        "table": {
          "table_name": "cscart_categories",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": ["lillyshop_lillyshop.cscart_products_categories.category_id"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "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')"
        }
      }
    ]
  }
}

Result

product_id category_ids
23414 1173M
23415 1173M
23416 1173M
23417 1173M
23418 1173M
23419 1173M
23420 1173M
23421 1173M
23422 1173M
23423 1173M
23424 1173M
23425 1173M
23426 1173M
23427 1173M
23455 1177M
23476 1178M
23477 1178M
23478 1178M
23479 1178M
23480 1178M
23481 1178M
23482 1178M
23928 1178M
23929 1178M