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