A mean value formula and a Liouville theorem for the complex Monge-Amp\`ere equation