(Too long for a comment)
In the same spirit as Jorge's great answer, I wanted to complete the discussion by making the following remark : the Lagrangian formalism has not been really designed for tackling second-order equation of motion, whence the present difficulty to find a suitable Lagrangian. On the contrary, the Hamiltonian mechanics does it pretty well.
Indeed, recalling that the equations of motion generated by a Hamiltonian $H(q,p)$ are given by
$$
\begin{cases}
\displaystyle \dot{q} = +\frac{\partial H}{\partial p} \\
\displaystyle \dot{p} = -\frac{\partial H}{\partial q}
\end{cases}
$$
and setting $\dot{p} = p^2$, we thus have $H(q,p) = -p^2q + f(q)$, where $f(q)$ is an arbitrary function, and the work is done. Note that the conjugate variable obeys consequently the following equation of motion : $\dot{q} = -2pq$. Of course, we could have inverted the roles of the two conjugate variables.
In addition, since $p = -\frac{\dot{q}}{2q}$, the associated Lagrangian would be given by
$$
L(q,\dot{q}) = p\dot{q} - H = -\frac{\dot{q}^2}{2q} - \left(-\frac{\dot{q}^2}{4q}+f(q)\right) = -\frac{\dot{q}^2}{4q}-f(q).
$$
Let's check its functional derivative :
$$
\frac{\delta L}{\delta q} = \left(\frac{\partial}{\partial q} - \frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial}{\partial\dot{q}}\right)\left(-\frac{\dot{q}^2}{4q}-f(q)\right) = -f'(q),
$$
which fails to produce a differential equation. One could argue that we should have impose the equation of motion for the other conjugate variable at the very beginning, i.e. $\dot{q} = q^2$, but then the situation would get even worse, because the corresponding Lagrangian would be of the form $L = -\frac{1}{2}q^3 + g(q)$, with $g$ another arbitrary function.
In conclusion, the Lagrangian formalism fails to handle first-order equations of motion.