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 (
    23490, 23487, 23488, 23931, 23492, 23570, 
    23572, 23569, 23499, 23493, 23498, 
    23496, 23495, 23494, 23497, 23428, 
    23467, 23436, 23429, 23489, 23486, 
    23571, 23564
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00098

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": 46,
          "filtered": 100,
          "index_condition": "cscart_products_categories.product_id in (23490,23487,23488,23931,23492,23570,23572,23569,23499,23493,23498,23496,23495,23494,23497,23428,23467,23436,23429,23489,23486,23571,23564)"
        }
      },
      {
        "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
23428 1174M
23429 1176M
23436 1177M
23467 1177M
23486 1179M
23487 1179M
23488 1179M
23489 1179M
23490 1179M
23492 1179M
23493 1179M
23494 1179M
23495 1179M
23496 1179M
23497 1179M
23498 1179M
23499 1179M
23564 1179M
23569 1179M
23570 1179M
23571 1179M
23572 1179M
23931 1179M