SELECT 
  category_id, 
  parent_id 
FROM 
  categories 
WHERE 
  parent_id IN(
    20877, 20878, 20885, 20922, 20879, 20886, 
    20887, 20888, 20890, 20889, 20880, 
    20891, 20923, 20892, 20896, 20881, 
    20897, 20924, 20898, 20899, 20900, 
    20893, 20901, 20902, 20903, 20882, 
    20904, 20883, 20905, 20906, 20907, 
    20895, 20908, 20909, 20910, 20925, 
    20894, 20926, 20911, 20912, 20884, 
    20913, 20914, 20915, 20916, 20917, 
    20918, 20919, 20927, 20920, 20921
  )

Query time 0.00101

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "13.10"
    },
    "table": {
      "table_name": "categories",
      "access_type": "range",
      "possible_keys": [
        "parent"
      ],
      "key": "parent",
      "used_key_parts": [
        "parent_id"
      ],
      "key_length": "3",
      "rows_examined_per_scan": 62,
      "rows_produced_per_join": 62,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "6.90",
        "eval_cost": "6.20",
        "prefix_cost": "13.10",
        "data_read_per_join": "162K"
      },
      "used_columns": [
        "category_id",
        "parent_id"
      ],
      "attached_condition": "(`goimagine`.`categories`.`parent_id` in (20877,20878,20885,20922,20879,20886,20887,20888,20890,20889,20880,20891,20923,20892,20896,20881,20897,20924,20898,20899,20900,20893,20901,20902,20903,20882,20904,20883,20905,20906,20907,20895,20908,20909,20910,20925,20894,20926,20911,20912,20884,20913,20914,20915,20916,20917,20918,20919,20927,20920,20921))"
    }
  }
}

Result

category_id parent_id
20878 20877
20879 20877
20880 20877
20881 20877
20882 20877
20883 20877
20884 20877
20913 20906
20922 20921
20923 20921
20924 20921
20925 20921
20926 20921
20927 20921