You can understand the expression by attempting the limit for $v\rightarrow c$ and $m\rightarrow0$. Notice that $\gamma\rightarrow\infty$ when $v\rightarrow c$. Therefore $m v \gamma$ is an undetermination of the form $0\cdot\infty$. From your expressions, you cannot say that $E=0$. The limit does not exist, and this implies that this expression is not valid for a massless particle.
Actually, if I can go a bit further, you can wonder what would happen if we relax one of the two properties: being massless and travelling at $c$. If the particle is not massless, then $E=m c^2 \gamma$ enforces the fact that it cannot travel at $v=c$, or otherwise $\gamma\rightarrow\infty$ and the particle would have infinite energy. Also, if it does not travel at $v=c$, then it cannot be massless, or otherwise it would not have energy. The conclusion of this would be that only massless particles can travel at $v=c$, and particles that travel at $v=c$ must be necessarily massless. In other words, a particle is massless if and only if it travels at $v=c$, which is actually a fact.