After a bit more research I found you can set the timeout of the request. I've set it to 1sec and it seems to work fine.
However, I still don't believe it's the best solution, 1 second is still a long time to delay a request for.
$DBH = new PDO("mysql:host=$host;dbname=$dbname", $username, $password,array(PDO::ATTR_TIMEOUT => "1"));