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 = 7265 
WHERE 
  cscart_products_categories.product_id IN (
    89173, 90321, 90322, 90325, 90324, 90326, 
    90323, 90329, 90330, 90331, 90333, 
    90334, 90337, 90338, 90339, 90340, 
    90341, 90342, 90345, 90346, 90347, 
    90348, 90328, 90332, 90335, 90336, 
    90343, 90344, 90327, 90317, 90319, 
    90320, 94119, 94120, 94121, 94122, 
    94123, 94124, 94125, 94126, 94127, 
    94128, 94129, 94130, 94131, 94132, 
    94133, 94134, 94135, 94136, 94137, 
    94138, 94139, 94457, 94839, 94840, 
    94841, 95319, 95365, 95366, 95367, 
    95368, 95369, 95370, 95371, 95372, 
    95373, 95374, 95375, 95377, 95927, 
    95928, 95929, 95930, 95931, 96494, 
    96495, 96496, 96497, 96498, 96499, 
    96500, 96501, 96502, 96503, 96504, 
    96505, 96506, 96507, 96509, 97581, 
    100143, 100436, 101011, 101012, 101013
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01002

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "131.83"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "7.46"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 208,
            "rows_produced_per_join": 8,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "20.72",
              "eval_cost": "0.83",
              "prefix_cost": "21.55",
              "data_read_per_join": "21K"
            },
            "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": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 117,
            "rows_produced_per_join": 7,
            "filtered": "0.76",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.75",
              "prefix_cost": "121.75",
              "data_read_per_join": "119"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (89173,90321,90322,90325,90324,90326,90323,90329,90330,90331,90333,90334,90337,90338,90339,90340,90341,90342,90345,90346,90347,90348,90328,90332,90335,90336,90343,90344,90327,90317,90319,90320,94119,94120,94121,94122,94123,94124,94125,94126,94127,94128,94129,94130,94131,94132,94133,94134,94135,94136,94137,94138,94139,94457,94839,94840,94841,95319,95365,95366,95367,95368,95369,95370,95371,95372,95373,95374,95375,95377,95927,95928,95929,95930,95931,96494,96495,96496,96497,96498,96499,96500,96501,96502,96503,96504,96505,96506,96507,96509,97581,100143,100436,101011,101012,101013))"
          }
        },
        {
          "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": 7,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.87",
              "eval_cost": "0.75",
              "prefix_cost": "124.36",
              "data_read_per_join": "119"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
89173 7247M,7265 0
90317 7247M,7265 0
90319 7247M,7265 0
90320 7247M,7265 0
90321 7247M,7265 0
90322 7247M,7265 0
90323 7247M,7265 0
90324 7247M,7265 0
90325 7247M,7265 0
90326 7247M,7265 0
90327 7247M,7265 0
90328 7247M,7265 0
90329 7247M,7265 0
90330 7247M,7265 0
90331 7247M,7265 0
90332 7247M,7265 0
90333 7247M,7265 0
90334 7247M,7265 0
90335 7247M,7265 0
90336 7247M,7265 0
90337 7247M,7265 0
90338 7247M,7265 0
90339 7247M,7265 0
90340 7247M,7265 0
90341 7247M,7265 0
90342 7247M,7265 0
90343 7247M,7265 0
90344 7247M,7265 0
90345 7247M,7265 0
90346 7247M,7265 0
90347 7247M,7265 0
90348 7247M,7265 0
94119 7247M,7265 0
94120 7247M,7265 0
94121 7247M,7265 0
94122 7247M,7265 0
94123 7247M,7265 0
94124 7247M,7265 0
94125 7247M,7265 0
94126 7247M,7265 0
94127 7247M,7265 0
94128 7247M,7265 0
94129 7247M,7265 0
94130 7247M,7265 0
94131 7247M,7265 0
94132 7247M,7265 0
94133 7247M,7265 0
94134 7247M,7265 0
94135 7247M,7265 0
94136 7247M,7265 0
94137 7247M,7265 0
94138 7247M,7265 0
94139 7247M,7265 0
94457 7247M,7265 0
94839 7247M,7265 0
94840 7247M,7265 0
94841 7247M,7265 0
95319 7247M,7265 0
95365 7247M,7265 0
95366 7247M,7265 0
95367 7247M,7265 0
95368 7247M,7265 0
95369 7247M,7265 0
95370 7247M,7265 0
95371 7247M,7265 0
95372 7247M,7265 0
95373 7247M,7265 0
95374 7247M,7265 0
95375 7247M,7265 0
95377 7247M,7265 0
95927 7247M,7265 0
95928 7247M,7265 0
95929 7247M,7265 0
95930 7247M,7265 0
95931 7247M,7265 0
96494 7247M,7265 0
96495 7247M,7265 0
96496 7247M,7265 0
96497 7247M,7265 0
96498 7247M,7265 0
96499 7247M,7265 0
96500 7247M,7265 0
96501 7247M,7265 0
96502 7247M,7265 0
96503 7247M,7265 0
96504 7247M,7265 0
96505 7247M,7265 0
96506 7247M,7265 0
96507 7247M,7265 0
96509 7247M,7265 0
97581 7247M,7265 0
100143 7247M,7265 0
100436 7247M,7265 0
101011 7247M,7265 0
101012 7247M,7265 0
101013 7247M,7265 0