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 (
    1414, 1453, 1452, 1407, 1432, 1451, 1445, 
    1411, 1449, 1406, 1448, 1447, 1413, 
    1439, 1419, 1444, 1443, 1418, 1442, 
    1420, 1441, 1440, 1433, 1438, 1436, 
    1435, 1434, 1415, 1431, 1430, 1429, 
    1428, 1427, 1426, 1425, 1424, 1423, 
    1422, 1421, 1417, 1416, 1412, 1410, 
    153, 1409, 1408, 1405, 297
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00179

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": 49,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (1414,1453,1452,1407,1432,1451,1445,1411,1449,1406,1448,1447,1413,1439,1419,1444,1443,1418,1442,1420,1441,1440,1433,1438,1436,1435,1434,1415,1431,1430,1429,1428,1427,1426,1425,1424,1423,1422,1421,1417,1416,1412,1410,153,1409,1408,1405,297)"
    },
    "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
153 7M
297 12M
1405 17M
1406 39M
1407 7M
1408 16M
1409 20M
1410 39M
1411 13M
1412 7M
1413 39M
1414 11M
1415 7M
1416 39M
1417 15M
1418 7M
1419 39M
1420 11M
1421 39M
1422 39M
1423 7M
1424 7M
1425 7M
1426 7M
1427 7M
1428 7M
1429 7M
1430 7M
1431 7M
1432 39M
1433 11M
1434 7M
1435 11M
1436 13M
1438 11M
1439 15M
1440 11M
1441 11M
1442 11M
1443 7M
1444 7M
1445 11M
1447 39M
1448 11M
1449 25M
1451 8M
1452 7M
1453 7M