UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '39pOBfp6ea4kzGdRPTHG7bXMq1rG30xWQFqESCk+Fk8='
WHERE
key_id = '15695436c4aaee29907cc39518ecec3c606511f9a9acc77201258a1062b6018c'
AND (
token = '39pOBfp6ea4kzGdRPTHG7bXMq1rG30xWQFqESCk+Fk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)