Allow only single product in Cart
If the module uc_restrict_qty not working file your issue there. Alternatively You can achieve this with help of hook hook_uc_add_to_cart

hook_uc_add_to_cart($nid, $qty, $data) 



  Performs extra processing when an item is added to the shopping cart.


Inside hook you can check your conditions, and prevent your new item to add. 

uc_cart_get_contents() can used to get existing contents of cart. If it is greater than 1 you can do your logic here, either remove previous one and add the current one or remove the new item