SELECT 
  category_id, 
  parent_id 
FROM 
  categories 
WHERE 
  parent_id IN(
    20877, 20886, 20887, 20888, 20889, 20880, 
    20896, 20881, 20899, 20900, 20902, 
    20903, 20904, 20883, 20906, 20907, 
    20895, 20910, 20894, 20911, 20884, 
    20915, 20916, 20917, 20918
  )

Query time 0.00130

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "6.88"
    },
    "table": {
      "table_name": "categories",
      "access_type": "range",
      "possible_keys": [
        "parent"
      ],
      "key": "parent",
      "used_key_parts": [
        "parent_id"
      ],
      "key_length": "3",
      "rows_examined_per_scan": 31,
      "rows_produced_per_join": 31,
      "filtered": "100.00",
      "using_index": true,
      "cost_info": {
        "read_cost": "3.78",
        "eval_cost": "3.10",
        "prefix_cost": "6.88",
        "data_read_per_join": "81K"
      },
      "used_columns": [
        "category_id",
        "parent_id"
      ],
      "attached_condition": "(`goimagine`.`categories`.`parent_id` in (20877,20886,20887,20888,20889,20880,20896,20881,20899,20900,20902,20903,20904,20883,20906,20907,20895,20910,20894,20911,20884,20915,20916,20917,20918))"
    }
  }
}

Result

category_id parent_id
20878 20877
20879 20877
20880 20877
20881 20877
20882 20877
20883 20877
20884 20877
20913 20906