UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'huScxID8oEq/QsmnMZIA3MB3iH5SJHmF4DBcg80wEqI='
WHERE
key_id = '6b0fa6697c474b5b6d4f4ba65c5a07205227d1697e21da6480898e30fa15ce5e'
AND (
token = 'huScxID8oEq/QsmnMZIA3MB3iH5SJHmF4DBcg80wEqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)