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