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 = 7187 
WHERE 
  cscart_products_categories.product_id IN (
    84022, 84023, 84024, 84025, 84037, 92043, 
    92044, 92045, 92046, 92047, 92048, 
    92049, 92059, 92060, 92061, 92062, 
    92063, 92064, 92065, 92075, 92076, 
    92077, 92078, 92079, 92080, 92081, 
    92131, 92132, 92133, 92134, 92135, 
    92136, 92137, 89014, 92019, 92020, 
    92021, 92022, 92023, 92024, 92025, 
    92107, 92108, 92109, 92110, 92111, 
    92112, 92113, 89651, 84014, 84015, 
    84016, 84017, 84036, 89011, 90109, 
    83978, 83979, 83980, 83981, 88936, 
    89648, 83970, 83971, 83972, 83973, 
    89650, 90083, 84030, 84031, 84032, 
    84033, 84038, 88935, 88934, 83131, 
    90084, 89647, 89642, 89644, 90110, 
    92042, 92058, 92074, 92130, 85534, 
    90090, 90100, 83105, 84111, 88930, 
    90107, 90080, 89526, 90064, 89641
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00309

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "109.29"
    },
    "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": 192,
            "rows_produced_per_join": 192,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "19.53",
              "eval_cost": "19.20",
              "prefix_cost": "38.73",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (84022,84023,84024,84025,84037,92043,92044,92045,92046,92047,92048,92049,92059,92060,92061,92062,92063,92064,92065,92075,92076,92077,92078,92079,92080,92081,92131,92132,92133,92134,92135,92136,92137,89014,92019,92020,92021,92022,92023,92024,92025,92107,92108,92109,92110,92111,92112,92113,89651,84014,84015,84016,84017,84036,89011,90109,83978,83979,83980,83981,88936,89648,83970,83971,83972,83973,89650,90083,84030,84031,84032,84033,84038,88935,88934,83131,90084,89647,89642,89644,90110,92042,92058,92074,92130,85534,90090,90100,83105,84111,88930,90107,90080,89526,90064,89641))"
          }
        },
        {
          "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": 9,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "48.00",
              "eval_cost": "0.96",
              "prefix_cost": "105.93",
              "data_read_per_join": "25K"
            },
            "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": 9,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.40",
              "eval_cost": "0.96",
              "prefix_cost": "109.29",
              "data_read_per_join": "153"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
83105 7184,7187M 0
83131 7184,7187M 0
83970 7184,7187M 0
83971 7184,7187M 0
83972 7184,7187M 0
83973 7184,7187M 0
83978 7184,7187M 0
83979 7184,7187M 0
83980 7184,7187M 0
83981 7184,7187M 0
84014 7184,7187M 0
84015 7184,7187M 0
84016 7184,7187M 0
84017 7184,7187M 0
84022 7184,7187M 0
84023 7184,7187M 0
84024 7184,7187M 0
84025 7184,7187M 0
84030 7184,7187M 0
84031 7184,7187M 0
84032 7184,7187M 0
84033 7184,7187M 0
84036 7184,7187M 0
84037 7184,7187M 0
84038 7184,7187M 0
84111 7184,7187M 0
85534 7184,7187M 0
88930 7184,7187M 0
88934 7184,7187M 0
88935 7184,7187M 0
88936 7184,7187M 0
89011 7184,7187M 0
89014 7184,7187M 0
89526 7184,7187M 0
89641 7184,7187M 0
89642 7184,7187M 0
89644 7184,7187M 0
89647 7184,7187M 0
89648 7184,7187M 0
89650 7184,7187M 0
89651 7184,7187M 0
90064 7184,7187M 0
90080 7184,7187M 0
90083 7184,7187M 0
90084 7184,7187M 0
90090 7184,7187M 0
90100 7184,7187M 0
90107 7184,7187M 0
90109 7184,7187M 0
90110 7184,7187M 0
92019 7187,7184M 0
92020 7187,7184M 0
92021 7187,7184M 0
92022 7187,7184M 0
92023 7187,7184M 0
92024 7187,7184M 0
92025 7187,7184M 0
92042 7187,7184M 0
92043 7187,7184M 0
92044 7187,7184M 0
92045 7187,7184M 0
92046 7187,7184M 0
92047 7187,7184M 0
92048 7187,7184M 0
92049 7187,7184M 0
92058 7187,7184M 0
92059 7187,7184M 0
92060 7187,7184M 0
92061 7187,7184M 0
92062 7187,7184M 0
92063 7187,7184M 0
92064 7187,7184M 0
92065 7187,7184M 0
92074 7187,7184M 0
92075 7187,7184M 0
92076 7187,7184M 0
92077 7187,7184M 0
92078 7187,7184M 0
92079 7187,7184M 0
92080 7187,7184M 0
92081 7187,7184M 0
92107 7187,7184M 0
92108 7187,7184M 0
92109 7187,7184M 0
92110 7187,7184M 0
92111 7187,7184M 0
92112 7187,7184M 0
92113 7187,7184M 0
92130 7187,7184M 0
92131 7187,7184M 0
92132 7187,7184M 0
92133 7187,7184M 0
92134 7187,7184M 0
92135 7187,7184M 0
92136 7187,7184M 0
92137 7187,7184M 0