UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9oyEwuQAYgqnpQfATkMS1vRwm6Dzlp8hI8xHrwZaZ20='
WHERE
key_id = 'a37140064cbe94cc19ed399cd70f1b41f3a8f5af79fb8b8c4d72647d636a8927'
AND (
token = '9oyEwuQAYgqnpQfATkMS1vRwm6Dzlp8hI8xHrwZaZ20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)