UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DWQCswi2+zGf8/tFz9okPouwsUhpD4Vp6rf1DrryHbo=' 
WHERE 
  key_id = '6ec186e127054af18e407c84a587e2997e241b134bd8ce70276a1467ffe064ae' 
  AND (
    token = 'DWQCswi2+zGf8/tFz9okPouwsUhpD4Vp6rf1DrryHbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032