UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q/cZP3ljfDMozCToe89hiCVijTx9fEOGYKtQ2CxQTcc='
WHERE
key_id = 'b45254fd1c496c41f2654f4f73768d4f78ca218435d9435c096832c05b83ef78'
AND (
token = 'q/cZP3ljfDMozCToe89hiCVijTx9fEOGYKtQ2CxQTcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)