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, 
  product_position_source.position AS position 
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') 
  LEFT JOIN cscart_products_categories AS product_position_source ON cscart_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 7170 
WHERE 
  cscart_products_categories.product_id IN (
    93465, 93466, 93467, 93468, 93469, 93470, 
    93471, 93472, 93473, 93474, 93475, 
    93476, 93477, 93478, 93479, 93480, 
    93481, 93482, 93483, 93484, 93485, 
    93486, 93487, 93488, 93489, 93490, 
    93491, 93492, 93493, 93494, 93495, 
    93496, 93497, 93498, 93499, 93500, 
    93501, 93502, 93503, 93504, 93505, 
    93506, 93507, 93508, 93509, 93510, 
    93511, 93512, 93513, 93514, 93529, 
    93530, 93531, 93532, 93533, 93534, 
    93535, 93536, 93537, 93538, 93539, 
    93540, 93541, 93542, 93543, 93544, 
    93545, 93546, 93547, 93548, 93549, 
    93550, 93551, 93552, 93553, 93554, 
    93555, 93556, 93557, 93558, 93559, 
    93560, 93561, 93562, 93563, 93564, 
    93565, 93566, 93567, 93568, 93569, 
    93570, 93571, 93572, 93573, 93574
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00227

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "54.77"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 96,
            "rows_produced_per_join": 96,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.89",
              "eval_cost": "9.60",
              "prefix_cost": "19.49",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (93465,93466,93467,93468,93469,93470,93471,93472,93473,93474,93475,93476,93477,93478,93479,93480,93481,93482,93483,93484,93485,93486,93487,93488,93489,93490,93491,93492,93493,93494,93495,93496,93497,93498,93499,93500,93501,93502,93503,93504,93505,93506,93507,93508,93509,93510,93511,93512,93513,93514,93529,93530,93531,93532,93533,93534,93535,93536,93537,93538,93539,93540,93541,93542,93543,93544,93545,93546,93547,93548,93549,93550,93551,93552,93553,93554,93555,93556,93557,93558,93559,93560,93561,93562,93563,93564,93565,93566,93567,93568,93569,93570,93571,93572,93573,93574))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "24.00",
              "eval_cost": "0.48",
              "prefix_cost": "53.09",
              "data_read_per_join": "12K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 4,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.20",
              "eval_cost": "0.48",
              "prefix_cost": "54.77",
              "data_read_per_join": "76"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
93465 7192M
93466 7192M
93467 7192M
93468 7192M
93469 7192M
93470 7192M
93471 7192M
93472 7192M
93473 7192M
93474 7192M
93475 7192M
93476 7192M
93477 7192M
93478 7192M
93479 7192M
93480 7192M
93481 7192M
93482 7192M
93483 7192M
93484 7192M
93485 7192M
93486 7192M
93487 7192M
93488 7192M
93489 7192M
93490 7192M
93491 7192M
93492 7192M
93493 7192M
93494 7192M
93495 7192M
93496 7192M
93497 7192M
93498 7192M
93499 7192M
93500 7192M
93501 7192M
93502 7192M
93503 7192M
93504 7192M
93505 7192M
93506 7192M
93507 7192M
93508 7192M
93509 7192M
93510 7192M
93511 7192M
93512 7192M
93513 7192M
93514 7192M
93529 7201M
93530 7201M
93531 7201M
93532 7201M
93533 7192M
93534 7192M
93535 7192M
93536 7192M
93537 7192M
93538 7192M
93539 7192M
93540 7192M
93541 7192M
93542 7192M
93543 7192M
93544 7192M
93545 7192M
93546 7192M
93547 7192M
93548 7192M
93549 7192M
93550 7192M
93551 7192M
93552 7192M
93553 7192M
93554 7192M
93555 7192M
93556 7192M
93557 7192M
93558 7192M
93559 7192M
93560 7192M
93561 7192M
93562 7192M
93563 7192M
93564 7192M
93565 7192M
93566 7192M
93567 7192M
93568 7192M
93569 7192M
93570 7192M
93571 7192M
93572 7192M
93573 7192M
93574 7192M