You can use unique field , autosku and tokens module
using that module set the name of sku using tokens
While generating sku use tokens
the parameters which u know differentiates 2 products should be used in tokens
Like if quantity and size is the parameter which differentiates your 2 products and defines two products as unique
using tokens(for e.g.) [product:qty] and [product:size]
set the sku title
and using unique field set the sku as required and unique field
You can try the following function to edit the quantity :
you can set cart quantity for a single item to be default value 1.
Allows modules to perform additional processing to refresh an
individual line item on a shopping cart order.
Prior to this hook being invoked, product line items will have already
had their sell prices refreshed via the creation of a new line item
for the same product being passed through Rules for calculation.
$line_item: A line item object that should be updated as necessary for
$order_wrapper: An EntityMetadataWrapper for the order the line item
is attached to.