UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QkR2GJ+b2vsmWqLKK61T0jfdS7ao0klvIYStQ5XPYtM=' 
WHERE 
  key_id = '80129922faa31413c56f4bcf321648acc67fb1a02043e7f96ef4407918414f09' 
  AND (
    token = 'QkR2GJ+b2vsmWqLKK61T0jfdS7ao0klvIYStQ5XPYtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032