SELECT 
  a.category_id 
FROM 
  cscart_categories as a 
  LEFT JOIN cscart_categories as b ON b.category_id IN (387) 
WHERE 
  a.id_path LIKE CONCAT(b.id_path, '/%')

Query time 0.00011

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "b",
          "access_type": "const",
          "possible_keys": ["PRIMARY", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": ["const"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "a",
          "access_type": "ALL",
          "rows": 525,
          "filtered": 100,
          "attached_condition": "a.id_path like <cache>(concat('387','/%'))"
        }
      }
    ]
  }
}

Result

category_id
745
741
1112
693
679
681
659
657
1022
1108
582
1073
713
574
522
470
479
481
651
515
754
760
1097
744
1105
1106
726
1110
755
743
450
1104
429
430
434
435
448
415
1098
594
1066
1107
468
489
493
497
498
499
500
758
414
388
765
768
774
777
782
784
786
1087
792
794
1131
819
828
1094
833
837
844
1134
1109
1099
1100
1101
1102
1103
884
885
1088
939
941
942
950
952
961
1186
1021
1016
1017
1028
1032
1135
1188
1168
1185
1156
1157
1162
1166
1169
1171
1179
1181
1182
1183
1184
1192