EDIT: I had missed that the original question was specificaly related to when the laptop was locked, but still powered on. While what is possible would heavily depend on any vulnerability in the OS, the fact that the computer is locked makes an attack more difficult, but still possible.
An attacker would need knowledge of specific flaws in the OS allowing transfer or storage of information. As the USB-port is powered when the screen is locked this is a possible attack vector.
It should also be noted that my original answer is still valid if you were to unlock the computer without noticing the device, as it would now be plugged in to an unlocked machine.
Original answer:
One of the simplest attacks for this scenario would probably be to insert a tiny device into the USB-port and hope you don't notice it. The device could be anything from a dummy keyboard programmed to input specific presses at a certain time, maybe to distract you, or hope to change some information. It could also have a transmitter, and exploit some vulnerability in the OS to leak information.
Exactly how likely this is to succeed would depend on whether you notice the device, and what exactly the device exploits.