UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JdA6SPWkQY+pyVLJG+HPXVX2FfYyZNoOuFgLoHKLits=' 
WHERE 
  key_id = 'b18a022446cfb555499a21c79aebd35d349d1dea8de976fe0256d10938a037b4' 
  AND (
    token = 'JdA6SPWkQY+pyVLJG+HPXVX2FfYyZNoOuFgLoHKLits=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035