UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qCkklSakOdq9dfjb/v6AOMNujLjHjJ9M0RG0HmYcJpU='
WHERE
key_id = '9aae7bf34fdedfdb3a20854b9a411394ee0c1e960f93eccfb4492838d10ed935'
AND (
token = 'qCkklSakOdq9dfjb/v6AOMNujLjHjJ9M0RG0HmYcJpU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)