A time-dependent response to optical excitation in molecular junctions