I need to query a serial number on a MySQL database, because of the sensitivity of this serial number it's stored as a bcrypt hash in the database. The hash is generated with a random salt which is default behavior from the password_hash() function.
The problem I'm encountering is that I need to query the database on this hash, there is no other required identifier. I can use a fixed salt but this is deprecated since PHP 7.0. I already know that the table will grow very big overtime, and that retrieving all results and then checking all the hashes would be quite troublesome. To future proof the hashing it has been determent that I need to use the password_hash() function.
Is there any way to query the database without sacrificing security, performance or using deprecated functionality?
As a sidenote, PDO is used to retrieve the results.