Target locks acquired using R4 Agromech’s ability may be used during the attack.
If a ship equipped with R4 Agromech is attacking with a secondary weapon that requires the ship to spend a focus token (such as a Blaster Turret or any weapon used with Deadeye), that ship cannot acquire a target lock on the defender because the enemy ship becomes the defender after the cost for the attack is paid (see Timing Chart for Performing an Attack. (X-Wing FAQ, Version 4.2.1, Updated 07/01/2016)
You may spend 1 focus token to change all focus results to hit results only once during the "Modify Attack" dice step. (X-Wing FAQ, Version 4.2.1, Updated 07/01/2016)