Tente isso:
SELECT IFNULL(AVG(valorm2), valortotal/area) valorm2 FROM tabela_terrenos
SELECT IFNULL(AVG(valorm2), valortotal/area) FROM tabela_terrenos