If it works when the car starts, the pump seems fine....
25 seconds is a little ecessive in my opinion - so could be the accumulator is knackered - this little dome contains a diaphram with Nitrogen pressure on one side and the brake fluid on the other, when the pump runs, it pressurises the brake fluid which pushes against the Nitrogen causing an increase in Nitrogen pressure, this is then used to maintain pressure in the hydraulic system - as you press the pedal, the Nitrogen pressure reduces and after about 10 or so pedal pushes, the pressure needs re-building and the pump runs again.
With the car running, after the pump has pressurised - press the brake pedal a few times - if the pump runs after one or two pushes, the accumulator is knackered, after about 5-7 pushes the accumulator is tired...it is runs on and off with out any pedal pushes - the accumulator is totally shot and maybe a tiny pressure leak in the system somewhere....
25 seconds is nothing, could be as much as 40-45 from cold start and okay
OP: Get the brakes bleed and new fluid, fluid gets old, tired - many countries require boiling point to certain level not required in UK - sure accumulator could have gone and nitrogen into fluid as well, if the accumulator is old change that as well - don't skimp on the brakes