SELECT 
  category_id, 
  parent_id 
FROM 
  cscart_categories 
WHERE 
  parent_id IN(
    7146, 
    7288, 
    7145, 
    7289, 
    7147, 
    7290, 
    7152, 
    7159, 
    7164, 
    7181, 
    7218, 
    7220, 
    7306, 
    7314, 
    7348, 
    7286, 
    7199, 
    7155, 
    7326, 
    7189, 
    7260, 
    7320, 
    7187, 
    7204, 
    7240, 
    7205, 
    7206, 
    7156, 
    7248, 
    7316, 
    7340, 
    7194, 
    7249, 
    7317, 
    7222, 
    7185, 
    7186, 
    7157, 
    7341, 
    7342, 
    7343, 
    7172, 
    7188, 
    7264, 
    7297, 
    7298, 
    7299, 
    7162, 
    7227, 
    7158, 
    7344, 
    7257, 
    7259, 
    7345, 
    7347, 
    7223, 
    7327, 
    7203, 
    7236, 
    7200, 
    7153, 
    7247, 
    7265, 
    7190, 
    7169, 
    7192, 
    7196, 
    7180, 
    7278, 
    7216, 
    7252, 
    7231, 
    7178, 
    7250, 
    7328, 
    7225, 
    7226, 
    7168, 
    7202, 
    7282, 
    7150, 
    7302, 
    7191, 
    7212, 
    7310, 
    7254, 
    7207, 
    7307, 
    7311, 
    7208, 
    7241, 
    7309, 
    7346, 
    7211, 
    7242, 
    7308, 
    7312, 
    7321, 
    7304, 
    7224, 
    7229, 
    7163, 
    7174, 
    7232, 
    7339, 
    7217, 
    7337, 
    7336, 
    7239, 
    7245, 
    7272, 
    7179, 
    7287, 
    7258, 
    7261, 
    7349, 
    7175, 
    7274, 
    7176, 
    7230, 
    7270, 
    7160, 
    7305, 
    7149, 
    7182, 
    7300, 
    7161, 
    7303, 
    7284, 
    7318, 
    7154, 
    7324, 
    7325, 
    7151, 
    7301, 
    7291, 
    7144, 
    7173, 
    7253, 
    7331, 
    7234, 
    7177, 
    7292, 
    7293, 
    7294, 
    7295, 
    7296, 
    7269, 
    7271, 
    7273, 
    7275, 
    7285, 
    7330, 
    7268, 
    7213, 
    7251, 
    7215, 
    7221, 
    7323, 
    7263, 
    7198, 
    7266, 
    7246, 
    7233, 
    7238, 
    7235, 
    7255, 
    7256, 
    7262, 
    7209, 
    7171, 
    7214, 
    7219, 
    7313, 
    7338, 
    7201, 
    7167, 
    7183, 
    7283, 
    7193, 
    7319, 
    7166, 
    7276, 
    7277, 
    7279, 
    7280, 
    7281, 
    7243, 
    7267, 
    7315, 
    7197, 
    7170, 
    7244, 
    7195, 
    7165, 
    7237, 
    7184, 
    7143, 
    7228, 
    7148, 
    7352, 
    7329, 
    7322, 
    7210, 
    7353, 
    7354
  ) 
  AND category_id != 1

Query time 0.00255

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "21.55"
    },
    "table": {
      "table_name": "cscart_categories",
      "access_type": "index",
      "possible_keys": [
        "PRIMARY",
        "parent",
        "p_category_id"
      ],
      "key": "parent",
      "used_key_parts": [
        "parent_id"
      ],
      "key_length": "3",
      "rows_examined_per_scan": 208,
      "rows_produced_per_join": 104,
      "filtered": "50.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "11.15",
        "eval_cost": "10.40",
        "prefix_cost": "21.55",
        "data_read_per_join": "271K"
      },
      "used_columns": [
        "category_id",
        "parent_id"
      ],
      "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`parent_id` in (7146,7288,7145,7289,7147,7290,7152,7159,7164,7181,7218,7220,7306,7314,7348,7286,7199,7155,7326,7189,7260,7320,7187,7204,7240,7205,7206,7156,7248,7316,7340,7194,7249,7317,7222,7185,7186,7157,7341,7342,7343,7172,7188,7264,7297,7298,7299,7162,7227,7158,7344,7257,7259,7345,7347,7223,7327,7203,7236,7200,7153,7247,7265,7190,7169,7192,7196,7180,7278,7216,7252,7231,7178,7250,7328,7225,7226,7168,7202,7282,7150,7302,7191,7212,7310,7254,7207,7307,7311,7208,7241,7309,7346,7211,7242,7308,7312,7321,7304,7224,7229,7163,7174,7232,7339,7217,7337,7336,7239,7245,7272,7179,7287,7258,7261,7349,7175,7274,7176,7230,7270,7160,7305,7149,7182,7300,7161,7303,7284,7318,7154,7324,7325,7151,7301,7291,7144,7173,7253,7331,7234,7177,7292,7293,7294,7295,7296,7269,7271,7273,7275,7285,7330,7268,7213,7251,7215,7221,7323,7263,7198,7266,7246,7233,7238,7235,7255,7256,7262,7209,7171,7214,7219,7313,7338,7201,7167,7183,7283,7193,7319,7166,7276,7277,7279,7280,7281,7243,7267,7315,7197,7170,7244,7195,7165,7237,7184,7143,7228,7148,7352,7329,7322,7210,7353,7354)) and (`nuie_scalesta_net`.`cscart_categories`.`category_id` <> 1))"
    }
  }
}

Result

category_id parent_id
7144 7143
7153 7143
7300 7143
7324 7143
7145 7144
7146 7144
7147 7144
7189 7144
7190 7144
7149 7148
7156 7148
7158 7148
7163 7148
7207 7148
7225 7148
7266 7148
7313 7148
7348 7148
7150 7149
7151 7149
7152 7149
7160 7149
7161 7149
7162 7149
7227 7149
7154 7153
7155 7153
7288 7153
7289 7153
7290 7153
7305 7153
7157 7156
7194 7156
7218 7156
7159 7158
7247 7158
7263 7158
7164 7163
7166 7165
7168 7165
7182 7165
7226 7165
7318 7165
7328 7165
7167 7166
7193 7166
7169 7168
7172 7168
7173 7168
7174 7168
7175 7168
7176 7168
7177 7168
7178 7168
7179 7168
7180 7168
7181 7168
7171 7170
7191 7170
7192 7170
7200 7170
7201 7170
7202 7170
7213 7170
7223 7170
7242 7170
7248 7170
7311 7170
7183 7182
7185 7184
7186 7184
7187 7184
7188 7184
7217 7184
7219 7184
7221 7184
7340 7184
7310 7191
7196 7195
7222 7195
7251 7195
7254 7195
7284 7195
7316 7195
7330 7195
7331 7195
7198 7197
7204 7197
7215 7197
7199 7198
7203 7198
7209 7198
7264 7198
7205 7204
7206 7204
7255 7204
7256 7204
7208 7207
7224 7207
7243 7207
7211 7210
7240 7210
7257 7210
7307 7210
7344 7210
7349 7210
7212 7211
7214 7211
7282 7211
7320 7211
7321 7211
7346 7211
7347 7211
7216 7215
7220 7219
7343 7219
7283 7225
7229 7228
7230 7228
7250 7228
7231 7230
7232 7230
7233 7230
7234 7230
7235 7230
7236 7230
7238 7237
7268 7237
7270 7237
7272 7237
7274 7237
7278 7237
7352 7237
7239 7238
7291 7238
7241 7240
7245 7244
7246 7244
7249 7248
7252 7251
7253 7251
7258 7257
7259 7257
7260 7257
7261 7257
7262 7257
7265 7257
7309 7257
7267 7266
7269 7268
7276 7268
7292 7268
7298 7268
7271 7270
7277 7270
7293 7270
7299 7270
7273 7272
7281 7272
7296 7272
7275 7274
7280 7274
7295 7274
7297 7274
7279 7278
7294 7278
7285 7284
7286 7284
7287 7284
7301 7300
7302 7300
7303 7300
7304 7300
7306 7300
7308 7307
7312 7311
7315 7311
7314 7313
7342 7313
7317 7316
7319 7318
7323 7322
7327 7322
7325 7324
7326 7324
7337 7336
7338 7336
7339 7336
7341 7340
7345 7344