Using the POST /alfresco/api/-default-/public/search/versions/1/search (REST API):
If you need to search for a file in a specific folder, the following query worked for me:
"query": "=PARENT:80c4e9ad-0a8e-4e25-a121-792b140a860a AND =name:'filenamehere.txt'"
The trick was to use '=' signs at the beginning of the query conditions. Without that it would not properly evaluate the query (returned nothing when both conditions were present).
Searching for a specific folder in a folder:
"query": "SELECT cmis:objectId FROM cmis:folder WHERE cmis:name = 'foldernamehere' and cmis:parentId = '308c9353-2de8-429a-8f1a-82ab250b5f12'",