UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8ygr4IRYj4MV9ofXlYnkRT0rrlB+uxN5qAaYFZ6jWz8='
WHERE
key_id = '0ce1077a8da18c922e1a4c34751b4244243a53248d0997a90b50a40cb5c80d4f'
AND (
token = '8ygr4IRYj4MV9ofXlYnkRT0rrlB+uxN5qAaYFZ6jWz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)