UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2lnLj7oJrZSGJtLOiKagb7T1xvxZysbZCaVOPTWPCQw='
WHERE
key_id = '8f2e51e1a9a5905660d3429312b6cc6b325dcbde8f5d66ee4eac65cfc72e540c'
AND (
token = '2lnLj7oJrZSGJtLOiKagb7T1xvxZysbZCaVOPTWPCQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)