UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '76utP4jZwU3d8ppRqr8To4RzOMFzsF0FtNLuieYLVx4='
WHERE
key_id = 'd5b20eaa7501b803042ece41e2b5c87b7dfb00cfcf5329385a81d19b942041f9'
AND (
token = '76utP4jZwU3d8ppRqr8To4RzOMFzsF0FtNLuieYLVx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)