On linux, /sys/block/<deviceName>/device/timeout (such as /sys/block/sda/device/timeout) is the timeout setting in seconds, which currently defaults to 30.

In the same directory, there is a eh_timeout value which is used for the SCSI commands TEST UNIT READY and REQUEST SENSE, so isn't what you're looking for.

As root, echo 1 > /sys/block/<deviceName>/device/timeout will change the timeout to 1 second. (Or, echo 3 for your 3 second example.)

As a non-root user, with sudo privileges, sudo bash -c "echo 1 > /sys/block/<deviceName>/device/timeout" will do the same.