UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jVgXW1VmhZCEkBsxcnLsNgENc+T8EhIdqihTsjZsvDU='
WHERE
key_id = 'a57fbbed57fd66524a3a2fcf12bafd905886139f04e654b3e6496d267528c36f'
AND (
token = 'jVgXW1VmhZCEkBsxcnLsNgENc+T8EhIdqihTsjZsvDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)