First to explain what I see...
* You have two InnoDB tables, each with only about 15K rows, and each being only a few MB in size.
* You are joining on a secondary key (filehash) and the SELECT is scanning one table, then reaching into the other table once per row.
* Normally, I would grumble about the wildcard at the beginning of a LIKE, but this is a case where it would not use an index anyway.
* You might be expecting 15K results? If you expecting only a few results, then the changed 'AND', below, might help.
I would not be surprised if it took a few seconds. But 40s ??
Perhaps innodb_buffer_pool_size is very low? It should be about 70% of _available_ RAM.
I doubt if it would help, but please try changing
AND webfiles.filepath LIKE CONCAT('%/', product_files.filename);
to
AND SUBSTRING_INDEX(webfiles.filepath, '/', -1) = product_files.filename;
If it is too small, you may be thrashing the disk. Do you have any metrics on CPU and disk usage during this query?