SELECT 
  c.parent_id, 
  sm.search_phrases, 
  c.category_id 
FROM 
  cscart_categories AS c 
  LEFT JOIN cscart_ab__search_motivation AS sm ON sm.category_id = c.category_id 
  AND sm.lang_code = 'en' 
WHERE 
  c.id_path LIKE "%925%" 
  AND (
    sm.search_phrases != "NULL" 
    OR c.level = (
      SELECT 
        level 
      FROM 
        cscart_categories 
      WHERE 
        category_id = 925
    )
  ) 
  AND c.company_id = 0 
  AND c.status = "A"

Query time 0.00049

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.31980987,
    "nested_loop": [
      {
        "table": {
          "table_name": "c",
          "access_type": "ALL",
          "loops": 1,
          "rows": 271,
          "cost": 0.0575922,
          "filtered": 100,
          "attached_condition": "c.company_id = 0 and c.id_path like '%925%' and c.`status` = 'A'"
        }
      },
      {
        "table": {
          "table_name": "sm",
          "access_type": "ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": ["u508912950_dev_2025.c.category_id"],
          "loops": 271,
          "rows": 1,
          "cost": 0.26221767,
          "filtered": 100,
          "attached_condition": "trigcond(sm.search_phrases <> 'NULL' or c.`level` = (subquery#2)) and trigcond(sm.lang_code = 'en')"
        }
      }
    ],
    "subqueries": [
      {
        "query_block": {
          "select_id": 2,
          "nested_loop": [
            {
              "table": {
                "table_name": "cscart_categories",
                "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
              }
            }
          ]
        }
      }
    ]
  }
}

Result

parent_id search_phrases category_id
0 925
925 1125
925 1126
925 1127
1125 1393
1125 1394
1125 1395
1125 1396
1125 1397
1125 1398
1125 1399
1126 1400
1126 1401
1126 1402
1126 1403
1126 1404
1126 1405
1126 1406
1126 1407
1127 1408
1127 1409
1127 1410
1127 1411