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