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