UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NaCyqpbc48C5v6ewsrel+KkXjyMIo5htb12hF6ni2OQ='
WHERE
key_id = '46dc66cacc466d73b1661f0c5f1c3fb115ea4da1b789d156b18270482c33648f'
AND (
token = 'NaCyqpbc48C5v6ewsrel+KkXjyMIo5htb12hF6ni2OQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)