UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7y+w9CCVr2h0tZ9/tUJzC/0qNZGPQju3Y4JFIzJMEbM='
WHERE
key_id = 'befe301ac0c2144383581e62e62748777ac97f04646a4aa53779562e3ac9cbff'
AND (
token = '7y+w9CCVr2h0tZ9/tUJzC/0qNZGPQju3Y4JFIzJMEbM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)