What is $\langle H \rangle$ in the infinite square well in the state $|\psi \rangle = | x_0 \rangle$, where $0 \le x_0 \le L$?

If the particle is in the state $\psi(x)=\delta(x-x_0) \ldots$

Unfortunately, that's a non-starter. Delta functions are not square-integrable, and therefore do not represent physical states. The expansion in terms of energy eigenfunctions is only guaranteed to converge if the function being expanded is square integrable, it's not possible to define expected values in non-normalizable states, etc. As a result, none of the expressions you've written are well-defined.

We can explore your question by considering the following family of functions: $$\psi_\epsilon(x):= \begin{cases}1/\sqrt \epsilon & x_0-\frac{\epsilon}{2}<x<x_0 + \frac{\epsilon}{2} \\ 0 & \text{else}\end{cases}$$

For all positive $\epsilon$ these functions are square-integrable with norm $\Vert \psi_\epsilon(x) \Vert = 1$. Therefore, we can plug them into your eigenfunction expansion to find

$$c_n = \sqrt{\frac{2}{\epsilon L}}\int_{x_0-\epsilon/2}^{x_0+\epsilon/2} \sin\left(\frac{n\pi x}{L}\right) \ \mathrm dx = -\sqrt{\frac{2L}{n^2\pi^2\epsilon}}\left[\cos\left(\frac{n\pi x_0}{L} + \frac{n\pi \epsilon}{2L}\right) - \cos\left(\frac{n\pi x_0}{L} - \frac{n\pi \epsilon}{2L}\right)\right]$$ $$= \sqrt{\frac{8L}{n^2\pi^2\epsilon}}\sin\left(\frac{n\pi x_0}{L}\right) \sin\left(\frac{n\pi \epsilon}{2L}\right)$$

and so

$$\left<H\right>_{\psi_\epsilon} = \sum_{n=1}^\infty \frac{n^2\pi^2 \hbar^2}{2mL^2} \cdot \frac{8L}{n^2\pi^2 \epsilon}\sin^2\left(\frac{n\pi x_0}{L}\right) \sin^2\left(\frac{n\pi \epsilon}{2L}\right)$$ $$=\frac{4\hbar^2}{\epsilon mL} \sum_{n=1}^\infty \sin^2\left(\frac{n\pi x_0}{L}\right) \sin^2\left(\frac{n\pi \epsilon}{2L}\right) \rightarrow \infty$$

Now, this sum diverges even if $\epsilon$ is not particularly small, i.e. the particle is not necessarily well-localized. The reason is because the Hamiltonian is proportional to the second derivative of the wavefunction, so a wavefunction which changes very sharply corresponds to a large expected value of the energy. Loosely speaking, our wavefunctions change infinitely quickly at the points of discontinuity, meaning that the expected value of the energy is not finite$^\dagger$.

A better example would be to use bump functions - smooth functions with compact support of the form

$$\psi_\epsilon(x) := \begin{cases} A_\epsilon e^{-\epsilon^2/(\epsilon^2-[x-x_0]^2)} & x_0-\epsilon < x < x_0+\epsilon \\ 0 & \text{else}\end{cases}$$

where $A_\epsilon$ is a normalization constant. These functions are continuous and differentiable at every point, and so they don't suffer from the same problems as our naive trial functions. They are, however, quite tedious to work with in this problem.

What we will find is that for each $\epsilon >0$ the expected value of the energy will be finite - but it will grow without bound as $\epsilon\rightarrow 0^+$. The reason for this is very similar to the naive case - if the bump function is normalized, then shrinking its width implies making it taller so as to enclose the same area. But this means that the rate at which the wavefunction changes (and by extension, its second derivative) grows without bound as the wavefunction becomes more and more narrow. As a result, we should expect that $\lim_{\epsilon\rightarrow 0^+} \left<H\right>_{\psi_\epsilon} \rightarrow \infty$. I'll trudge through the numerics just to demonstrate this.

To illustrate the point, let $L=\pi,m=\hbar=1$, and $x_0= \pi/2$. If we define $u\equiv (x-\pi/2)/\epsilon$, we find that

$$A_\epsilon \approx 2.74/\sqrt \epsilon$$ which yields coefficients in the sine expansion $$c_n = \int_0^\pi\sqrt{\frac{2}{\pi}}\sin(nx) \cdot \psi_\epsilon(x)\mathrm dx$$ $$ \approx \sqrt{\frac{2}{\pi}} \cdot \frac{2.74}{\sqrt{\epsilon}}\epsilon \int_{-1}^1 \sin(n\epsilon u + n \pi/2) e^{-1/(1-u^2)}$$

If $n=2k$ is even, $\sin(n\epsilon u + n\pi/2) = (-1)^k \sin(2k\epsilon u)$ and the coefficient vanishes. If it is odd, then the coefficients don't have a nice closed form, but can be solved for numerically: enter image description here

We can then calculate the expected energy as a function of $\epsilon$. This is the result:

enter image description here

So the main lesson here is that sharp changes in the wavefunction correspond to large expected values of $H$. Discontinuous wavefunctions will have $\langle H\rangle= \infty$, and wavefunctions which are well-localized will have large $\langle H \rangle$ which also tends to infinity as the localization gets sharper and sharper.

$^\dagger$There's nothing unphysical about this statement. Recall the statistical interpretation of the expected value - it is the average value expected after $N$ identical measurements, as $N\rightarrow \infty$. A non-finite expected value for the energy simply means that if you make a sufficient number of measurements, then your average result will become arbitrarily large rather than settling down to a finite limit. In particular, it doesn't mean that any individual measurement will yield an infinite result.

The first does not converge. $E_n$ is increasing with $n$, while $\sin^2(n\pi x_0/L)$ is oscillatory and positive-definite. I'll leave the proof of its divergence to you, but you shouldn't expect something to converge when its terms, on average, increase with $n$.

The integral also diverges, as is pretty much always the case when you have the same Dirac delta appearing twice in an integral.

Note that $|x_0\rangle$ is not a normalizable wave function, and as such is not a member of the Hilbert space. You shouldn't expect to get reasonable results if you try to treat it as a physical wavefunction. Neither the energy of this state nor the probability to measure a particular energy eigenstate are well-defined.

Also notice that even if these did converge, they have the wrong dimension! Both expressions have dimensions of energy over length (well your first expression has $1/L^2$, but that should be $1/L$), rather than just energy. So even if they converged, it should be obvious they're not going to give you a physically reasonable result.