UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3ZAwqcJwejyQ83iEPHswZH4b4lDKMTIgJiV36MCscQI='
WHERE
key_id = '4a97c1f6c741f9479675de4099cc0fb1726da1f58f67772a7b97a1bdd97b87a1'
AND (
token = '3ZAwqcJwejyQ83iEPHswZH4b4lDKMTIgJiV36MCscQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)