Unveiling time-varying signals of ultralight bosonic dark matter at collider and beam dump experiments