UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5j4NL4n9MMM6bnkJjuAnBja0Wlt4gQMrqbyG6Jrg2PU='
WHERE
key_id = 'd8042017b7078482296db5ce40321e892f4a45544ecc32d405b15ff7b612bd25'
AND (
token = '5j4NL4n9MMM6bnkJjuAnBja0Wlt4gQMrqbyG6Jrg2PU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)