UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'baQzqd0kqLdFvHcymMGYJNswLzC9Y0wxGgvsbDexMjE='
WHERE
key_id = '20d509ffbdd6d8dfc124be24eacd017e90ad82bb369e5be60a618a5b14b4a0c2'
AND (
token = 'baQzqd0kqLdFvHcymMGYJNswLzC9Y0wxGgvsbDexMjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)