UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CIzTV+/jEQ80rmCkyWfQhSVOAKuu1XMp/zA3fbx50kY='
WHERE
key_id = 'a9e1ff062cabc096ba1c7ad027085ac702899bef2886df5e959ae43faa572dd9'
AND (
token = 'CIzTV+/jEQ80rmCkyWfQhSVOAKuu1XMp/zA3fbx50kY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)