According to https://en.wikipedia.org/wiki/Up_quark the up quark can decay into a down quark plus a positron plus an electron neutrino. The problem is that the mass of the by-products is greater than the original particle. This would violate conservation of mass/energy unless some source of energy or mass was put into the system to trigger the decay.
The most common example of this is beta plus decay. In this process one of the up quarks in a proton decays into a down quark and a $W^+$, and the $W^+$ then decays into a positron and electron neutrino. As a result of the decay the proton converts to a neutron.
As you say, the process violates conservation of energy and that means it cannot occur unless energy can be supplied from some other source. An isolated proton cannot undergo beta plus decay to a neutron. However in a nucleus the rearrangement of the nucleons following the decay of the proton to a neutron can supply the required energy, and some nuclei can undergo this type of decay.
So you are quite correct that the decay violates conservation of energy, and therefore it can only happen when that missing energy required can be supplied from elsewhere.
Quarks can never be observed isolated, since they only exist in confinement. What you are asking about is basically the conversion of a proton into a neutron. Even then, the proton cannot decay in isolation (except if there is a incident antineutrino with sufficient energy), and there are basically two main types of cases where the proton can do this transformation into a neutron, one of them is covered in John Rennie's answer, where the proton exist inside a nucleus, together with other nucleons, and the extra energy you are asking about is supplied by the changes in the involved EM and residual strong forces.
The other case is electron capture, where the proton rich nucleus of an EM neutral atom absorbs an inner atomic electron. In most cases (except Auger effect) the atom stays EM neutral, the proton converts to a neutron, and all the decay energy is released in form of a neutrino. Contrary to popular belief, the electron is not from an external atom, but from inside the current atomic system. This electron supplies the extra energy you are asking about.