UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sYklwwLe5VFDtUdwlDQSFHiq6gYpUQwLHQw1TXblfoU='
WHERE
key_id = 'a53b3b586069d2ef68b99d3da2b26943cffecc49af5949df02b9d35708ec91b2'
AND (
token = 'sYklwwLe5VFDtUdwlDQSFHiq6gYpUQwLHQw1TXblfoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)