Certifying Optimality in Hybrid Control Systems via Lyapunov-like Conditions