UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QFSMXkz6WnAwUuW+hqkyZh7FYsEx5iknQjH+EdDRShs='
WHERE
key_id = '04a3b40efc03a4151fb2b339d7de492f3320f7ab6deee3b0432d2c5d0b7abc4f'
AND (
token = 'QFSMXkz6WnAwUuW+hqkyZh7FYsEx5iknQjH+EdDRShs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)