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 (
    1230, 1229, 1228, 1227, 1226, 1225, 1224, 
    1223, 1222, 1221, 1220, 1219, 1218, 
    1217, 1216, 1215, 1170, 1171, 1177, 
    1175, 1168, 1183, 1184, 1174, 1187, 
    67, 1191, 1176, 1167, 1169, 1194, 1179, 
    1180, 1181, 1197, 1182, 1201, 1202, 
    1198, 1178, 603, 1185, 1209, 1186, 1210, 
    1211, 1203, 1212
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00187

JSON explain

{
  "query_block": {
    "select_id": 1,
    "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 (1230,1229,1228,1227,1226,1225,1224,1223,1222,1221,1220,1219,1218,1217,1216,1215,1170,1171,1177,1175,1168,1183,1184,1174,1187,67,1191,1176,1167,1169,1194,1179,1180,1181,1197,1182,1201,1202,1198,1178,603,1185,1209,1186,1210,1211,1203,1212)"
    },
    "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": ["bacpvdev_db.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
67 13M
603 10M
1167 25M
1168 8M
1169 12M
1170 34M
1171 15M
1174 15M
1175 10M
1176 24M
1177 25M
1178 25M
1179 8M
1180 8M
1181 30M
1182 24M
1183 8M
1184 34M
1185 27M
1186 35M
1187 35M
1191 24M
1194 35M
1197 13M
1198 8M
1201 24M
1202 24M
1203 35M
1209 35M
1210 35M
1211 8M
1212 8M
1215 15M
1216 15M
1217 15M
1218 25M
1219 24M
1220 24M
1221 24M
1222 10M
1223 6M
1224 24M
1225 16M
1226 39M
1227 24M
1228 9M
1229 30M
1230 24M