The Closed Circuit TV (CCTV) cameras in the Space Shuttle Payload bay had optical zoom lenses.
Zoom capability magnifies or reduces the size of objects in a camera's field of view by adjusting the focal length of the lens. The minimum focus for standard lenses is 3 feet, the maximum is infinity.
(emphasis mine, reference)
(personal photo of camera switches in aft cockpit of Endeavour orbiter)
All 6 baseline cameras (payload bay A, B, C, D, Remote Manipulator System (RMS) elbow, RMS wrist) had zoom lenses. All except the RMS wrist had pan/tilt capability. Payload-specific keel/berthing cameras may or may not have had zoom lenses.
(source - Shuttle Crew Operations Manual - page 2.3-2)
Here is a video of the crew zooming the wrist camera to watch a water dump.
ISS USOS external cameras have zoom capability, both the baseline and the new High Def ones. See this answer: How are cameras arranged and used to monitor activities outside the ISS? for their locations.
You can see the camera zoom controls on this picture of the ISS Robotics Workstation's Display and Control Panel.