UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H5wNK4ABgWpdELRWJzb+yPjokvbqkTNSA8jR0Ey+ebM=' 
WHERE 
  key_id = '6939f514b53731dceb9046158095af60da0dc93c058824d226a1428434460c9b' 
  AND (
    token = 'H5wNK4ABgWpdELRWJzb+yPjokvbqkTNSA8jR0Ey+ebM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023