The general derivation of Hamilton’s equations involve the change in the hamiltonian and consequently the change in the Lagranian that is a function of q and q_dot, L(q,q_dot). This is shown in this simple video https://www.youtube.com/watch?v=jXu6zIItnLM
When deriving Hamilton’s equations for q_dot and p_dot, the lagranian is only a function of q and q_dot but not time. Therefore the Lagranian used to derive Hamilton’s equations is time-independent as it appears. Does that means that Hamilton’s equations for q_dot and p_dot are only right for systems for which the lagranian is time-independent (and therefore the hamiltonian- or energy is conserved) ?
Lagrange movement equations $(n)$ extracted from $L(q,\dot q,t)$ are equivalent to the $2n$ first order equations
$$ \cases{ \dot p = -H_q\\ \dot q = H_p } $$
with $H(p,q, t) = p\dot q-L(q,\dot q,t)$. This last equation is known as the Legendre transform. Here $L(q,\dot q,t)$ and $H(p,q, t)$ are respectively the Lagrangian and the Hamiltonian. Both can be non autonomous.